<?
if (isset($_POST['btnsubmit'])) {
    require("required/dbconnect.php");

    $content_eng = $_POST['content_eng'];
    $title_eng = mysql_escape_string($_POST['title_eng']);
    $order_id = $_POST['order_id'];
    $type = $_POST['type'];
    $status = $_POST['status'];

    $insert = mysql_query("insert into os_contents(content,title,order_id,content_type,status)value('$content_eng','$title_eng','$order_id','$type','$status')") or die(mysql_error());
    header("Location:content_viewall.php?action=1&type=$type");
} else {

    require("required/dbconnect.php");
    require("required/function.php");
    require("required/header.php");

    checkAccess("allow_content_management", 1);
    if (empty($_GET['type'])) {
        die("Illegal Action!!");
    }

    $type = $_GET['type'];
    ?>

    <table width="100%"  cellpadding="0" cellspacing="5" height="300">
        <script language="JavaScript" type="text/javascript" src="wysiwyg.js">
        </script>
        <script type="text/javascript" src="required/js/calendarDateInput.js"></script>		

        <td width="84%" align="left" valign="top">

            <form action="<?= $_SERVER['PHP_SELF'] ?>" name="frm" method="post" onSubmit="return validatefrm(this)">
                <table width="100%">

                    <td class="title" colspan="3">
                        Add Content for <?= getTypeName($type) ?>



                    </td>



                    <tr>
                        <td>Title</td><td>:</td><td><input class="text" type="text" name="title_eng" size="50" value="" maxlength="200"></td>
                    </tr>
                    <tr>
                        <td>Order ID</td><td>:</td><td><input type="text" name="order_id" maxlength="3" size="3"></td>
                    </tr>
                    <tr>
                        <td>Publish</td><td>:</td><td>
                            <select name="status">
                                <option value="1">Yes</option>
                                <option value="0">No</option>
                            </select>
                            
                        </td>
                    </tr>

                    <tr valign="top">
                        <td width="15%">Content </td><td width="3%">:</td>
                    </tr>
                    <tr>
                        <td  colspan="3" width="82%" valign="top">
    <? include_once("fckeditor/fckeditor.php") ?>
    <?php
    $oFCKeditor = new FCKeditor('content_eng');
    $oFCKeditor->ToolbarSet = 'DeswinBasic';
    $oFCKeditor->Height = 500;
    $oFCKeditor->BasePath = './fckeditor/';
    $oFCKeditor->Create();
    ?>
                        </td>
                    </tr>

                    <input type="hidden" value="<?= $type ?>" name="type">
                    <tr>
                        <td colspan="2"><input type="submit" value="Submit" name="btnsubmit"></td>
                    </tr>
                </table>
            </form>
        </td>

    </table>
<? }require("required/footer.php"); ?>